<template>
  <div
    class="page_body"
    v-loading.fullscreen.lock="loadingKey"
    :element-loading-text="loadingText"
  >
    <!-- 面包屑 -->
    <el-row>
      <el-col :span="24" class="page_box_top">
        <i class="el-icon-s-fold"></i>
        <el-breadcrumb separator="/" class="page_box_top_nav">
          <el-breadcrumb-item class="breadcrumb_active_item"
            >考试报名</el-breadcrumb-item
          >
          <el-breadcrumb-item>选择考试级别</el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row>
    <el-row>
      <div class="grade_list_content">
        <!-- 步骤条 -->
        <el-row type="flex" justify="center">
          <el-col :span="13">
            <div class="grade_list_steps">
              <div class="grade_list_steps_title">报名流程</div>
              <el-steps :active="0" finish-status="success" align-center>
                <el-step title="选择考试级别"></el-step>
                <el-step title="选择考试项目"></el-step>
                <el-step title="填写报名信息"></el-step>
                <el-step title="确认报名"></el-step>
                <el-step title="支付费用"></el-step>
              </el-steps>
            </div>
          </el-col>
        </el-row>
        <!-- 数据列表 -->
        <el-row type="flex" justify="center">
          <el-col :span="12">
            <el-table
              :data="gradeListData"
              border
              size="small"
              style="width: 100%"
            >
              <el-table-column
                type="index"
                label="序号"
                width="50"
                align="center"
              >
              </el-table-column>
              <el-table-column
                prop="title"
                label="考试项目级别"
                align="center"
              ></el-table-column>
              <el-table-column
                label="操作"
                width="160"
                itemprop=""
                align="center"
              >
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="primary"
                    icon="iconfont icon-w_fanhui"
                    @click="checkGrade(scope.$index, scope.row)"
                    >进入</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </el-col>
        </el-row>
        <!-- <el-row type="flex" justify="center">
          <el-col :span="14">
            <div class="grade_list_pagination">
              <el-pagination
                @size-change="listSizeChange"
                @current-change="listCurrentChange"
                :current-page="currentPage"
                :page-sizes="pageSizes"
                :page-size="pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="total"
              >
              </el-pagination>
            </div>
          </el-col>
        </el-row> -->
      </div>
    </el-row>
  </div>
</template>
<style src="../../assets/css/enroll/gradeList.css" scoped></style>

<script>
export default {
  name: "GradeList",
  components: {},
  data() {
    return {
      gradeListData: [],
      currentPage: 1, // 当前页
      pageSizes: [10, 20, 50, 100], // 可选页容量
      pageSize: 10, // 当前页容量
      total: 0, // 总条数
      loadingKey: false,
      loadingText: "",
    };
  },
  created: function () {
    this.getListDataFn();
  },
  methods: {
    // 获取列表数据
    getListDataFn: function () {
      let that = this;
      let url = "/mobile/categoryList";
      let data = {};
      that.loadingText = "加载中...";
      that.loadingKey = true;
      this.axios
        .post(url, data)
        .then((response) => {
          that.loadingKey = false;
          if (response.code == 0) {
            that.gradeListData = response.category_list;
          } else {
            this.$message.error(response.msg);
          }
        })
        .catch(function (error) {
          that.loadingKey = false;
          console.log(error);
        });
    },
    // 选择等级
    checkGrade: function (index, row) {
      this.$router.push({
        name: "CheckEnroll",
        params: {
          gradeId: row.id,
        },
      });
    },
    // 页容量改变
    listSizeChange: function () {},
    // 当前页改变
    listCurrentChange: function () {},
  },
};
</script>
